.PHONY: start build docker

NOW = $(shell date -u '+%Y%m%d%I%M%S')

RELEASE_VERSION = v1.0.0

APP 			= base
SERVER_BIN  	= ./cmd/${APP}
RELEASE_ROOT 	= release
RELEASE_SERVER 	= release/${APP}

all: start

build:
	@go build -ldflags "-w -s -X main.VERSION=$(RELEASE_VERSION)" -o $(SERVER_BIN) ./cmd

start:
	@go run cmd/main.go

#docker: build
#	@docker build -t ${APP}:${VERSION}

test:
	cd ./internal/test && go test -v

clean:
	rm -rf release && rm -f cmd/${APP}

pack: build
	rm -rf $(RELEASE_ROOT) && mkdir -p $(RELEASE_SERVER)
	cp -r $(SERVER_BIN) config $(RELEASE_SERVER)
	cd $(RELEASE_ROOT) && tar -cvf $(APP).tar ${APP} && rm -rf ${APP}